﻿namespace AgileDashboard.AppCode
{
    using System;

    public class BasePage : System.Web.UI.Page
    {

        /// <summary>
        /// Gets a value indicating whether the application is displayed in a kiosk mode
        /// </summary>
        public bool KioskMode
        {
            get
            {
                if (this.Request["kiosk"] != null)
                {
                    bool kioskMode;

                    if (bool.TryParse(this.Request["kiosk"], out kioskMode))
                    {
                        return kioskMode;
                    }
                }

                return false;
            }
        }


        #region Overrides of Control

        protected override void OnLoad(EventArgs e)
        {
            // technique borrowed from: http://aspalliance.com/668
            // add a global cache dependency for pages. If this item is explicitly removed from the cache (programatically), it will purge all page caches
            Response.AddCacheItemDependency(Properties.Settings.Default.GlobalPageCacheKey);

            base.OnLoad(e);
        }

        #endregion
    }
}